package com.oig.sys.msg.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.oig.common.validator.EnumValue;
import com.oig.common.validator.GroupAdd;
import com.oig.common.validator.GroupEdit;
import com.oig.sys.msg.constants.MsgEnums;
import io.swagger.v3.oas.annotations.media.Schema;

import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

@Schema
@Data
public class NoticeMsgDto {

	@Schema(description = "消息内容id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
	@NotNull(message = "参数错误,消息内容id不能为空", groups={GroupEdit.class})
	private Integer id;

	@Schema(description = "消息公告标题", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
	@NotEmpty(message = "参数错误,消息公告标题不能为空", groups={GroupAdd.class, GroupEdit.class})
	private String title;

	@Schema(description = "消息公告内容", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
	@NotEmpty(message = "参数错误,消息公告内容不能为空", groups={GroupAdd.class, GroupEdit.class})
	private String content;

	@Schema(description = "关联任务id")
	private String bizId;

	@Schema(description = "消息类型 01-定向消息 02-群消息")
	private String msgType;

	@Schema(description = "推送渠道id")
	//@NotNull(message = "参数错误,推送渠道id不能为空", groups={GroupAdd.class, GroupEdit.class})
	private Integer pushChannelId;
	@Schema(description = "推送机器人（渠道名称）")
	//@NotEmpty(message = "参数错误,渠道名称不能为空", groups={GroupAdd.class, GroupEdit.class})
	private String pushChannelName;

	@Schema(description = "消息接收方类型 01-租户全员 02-部门 03-人员", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
//	@NotEmpty(message = "参数错误,消息接收方类型不能为空", groups={GroupAdd.class, GroupEdit.class})
	@EnumValue(message = "消息接收方类型值不正确",enumClass = MsgEnums.ReceiverType.class, enumValidMethod = "validCode", groups={GroupAdd.class, GroupEdit.class})
	private String receiverType;

	@Schema(description = "消息接收方id,类型为租户全员时，公司全员收到，类型为部门时，部门人员收到 类型为人员时，noticeMsgReceiverDtoList 人员收，这个可不填")
	private Integer receiverId;
	@Schema(description = "消息接收方名称")
	private String receiverName;

	@Schema(description = "预发布时间")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date pubTime;

	@Schema(description = "所属租户id")
	private Integer tenantId;

	@Schema(description = "所属租户名称")
	private String tenantName;

	@Schema(description = "消息发布人id")
	private Integer createUserId;
	@Schema(description = "消息发布人")
	private String createUserName;
	@Schema(description = "消息发布人时间")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date createTime;

	@Schema(description = "消息修改人id")
	private Integer lastUpdateId;
	@Schema(description = "消息修改人")
	private String lastUpdateName;
	@Schema(description = "消息修改人时间")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date lastUpdateTime;

	@Schema(description = "复核人id")
	private Integer checkId;
	@Schema(description = "复核人")
	private String checkName;
	@Schema(description = "复核时间")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date checkTime;
	@Schema(description = "复核备注")
	private String checkRemark;

	@Schema(description = "发布人id")
	private Integer publisherId;
	@Schema(description = "发布人")
	private String publisherName;
	@Schema(description = "发布时间")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date publisherTime;

	@Schema(description = "接收人列表")
	private List<NoticeMsgReceiverDto> noticeMsgReceiverList;

	@Schema(description = "附件列表")
	private List<NoticeMsgFileDto> noticeMsgFileDtoList;

	@Schema(description = "0-保存，1-提交审核 默认保存")
	private String reqType;
}
